<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<body>
	<h:form id="frmCadGrade">
		<br />
		<h3 style="margin-top: 0">CADASTRO DA GRADE TRIBUTÁRIA</h3>
		<div align="left">
			<p:commandButton value="Novo"
				actionListener="#{gradeTributariaBean.novo}" ajax="grid" />

			<p:commandButton value="Salvar" disabled="#{gradeTributariaBean.sal}"
				actionListener="#{gradeTributariaBean.salvar}" ajax="grid"
				update="dialog2" />

			<p:commandButton value="Alterar"
				disabled="#{gradeTributariaBean.alt}"
				actionListener="#{gradeTributariaBean.alterar}" ajax="grid" />

			<p:commandButton value="Excluir"
				disabled="#{gradeTributariaBean.rem}"
				actionListener="#{gradeTributariaBean.remover}" ajax="grid" />

			<p:commandButton id="consulta" value="Consulta"
				action="#{pesquisaGradeTributariaBean.abrirDialogo}">
				<p:ajax event="dialogReturn" listener="#{gradeTributariaBean.gradeSelecionado}" update="frmCadGrade"/>
			</p:commandButton>

			<p:commandButton value="Cancelar"
				actionListener="#{gradeTributariaBean.cancelar}" ajax="grid" />
			<p:messages id="messages" showDetail="true" autoUpdate="true"
				closable="true" />

			<h:panelGrid id="grid" columns="2" columnClasses="label, value">
				
					Código da Grade:
					<p:inputText id="idGrade" disabled="true"
					value="#{gradeTributariaBean.grade.idGradeTrib}" />
		
					Descrição da Grade:
					<p:inputText id="descGrade"
					value="#{gradeTributariaBean.grade.descricao}" size="40"
					disabled="#{gradeTributariaBean.desc}" />

			</h:panelGrid>

			<p:commandButton id="vincGrade" value="Vigência Grade" type="button"
				update="gridincEdi2" disabled="#{gradeTributariaBean.vig}"
				onclick="PF('dlg2').show();" />

			<ui:include src="/privado/fiscal/dataTable/gradeTributariaVigenciaDataTable.xhtml" />

			<p:dialog id="dialog2" header="Inclusão e Edição da Vigência"
				widgetVar="dlg2" modal="true" height="320" width="400">

				<h:panelGrid id="gridincEdi2" columns="1"
					columnClasses="label, value">

					<h:panelGrid columns="4" columnClasses="label, value">
						<p:selectOneRadio id="entSai"
							value="#{gradeTributariaBean.tipoEntSai}">
							<f:selectItem itemLabel="Entrada" itemValue="ENTRADA" />
							<f:selectItem itemLabel="Saida" itemValue="SAIDA" />
						</p:selectOneRadio>
					</h:panelGrid>

					<h:panelGrid columns="2">
					Código da Vigência:
					<p:inputText id="idGradeVigencia" disabled="true"
							value="#{gradeTributariaBean.gradeVig.id}" />
							
					Descrição da Vigência:
					<p:inputText id="descGradeVigencia" size="29"
							value="#{gradeTributariaBean.gradeVig.descricao}" />
		
					Estado Origem:
						<p:selectOneMenu id="ufOr" style="width:200px;"
							value="#{gradeTributariaBean.gradeVig.origem}">
							<f:selectItem itemLabel="Selecione um estado origem" />
							<f:selectItems value="#{geralBean.estados}" var="listaEstados"
								itemValue="#{listaEstados}"
								itemLabel="#{listaEstados.descricao}" />
						</p:selectOneMenu>
					
					Estado Destino:
						<p:selectOneMenu id="ufDe" style="width:200px;"
							value="#{gradeTributariaBean.gradeVig.destino}">
							<f:selectItem itemLabel="Selecione um estado destino" />
							<f:selectItems value="#{geralBean.estados}" var="listaEstados"
								itemValue="#{listaEstados}"
								itemLabel="#{listaEstados.descricao}" />
						</p:selectOneMenu>
					
					Alíquota:
						<p:selectOneMenu id="aliq" style="width:200px;"
							value="#{gradeTributariaBean.gradeVig.aliquota}">
							<f:selectItem itemLabel="Selecione uma alíquota" />
							<f:selectItems value="#{gradeTributariaBean.listaAliquota}"
								var="listAliquota" itemValue="#{listAliquota}"
								itemLabel="#{listAliquota.idAliq} - #{listAliquota.aliquota}" />
						</p:selectOneMenu>
					
					Vigência:
					<p:calendar id="pautavigencia" size="29"
							value="#{gradeTributariaBean.gradeVig.vigencia}" effect="fold" />
	
					Tipo da Grade:
					<p:selectOneMenu id="tipGrade" style="width:200px;"
							value="#{gradeTributariaBean.tipoGrade}">/>
						<f:selectItem itemLabel="Selecione uma Opção" />
							<f:selectItem itemLabel="Distribuidor" itemValue="DISTRIBUIDOR" />
							<f:selectItem itemLabel="Fabricante" itemValue="FABRICANTE" />
							<f:selectItem itemLabel="Outros" itemValue="OUTROS" />
						</p:selectOneMenu>

					Pauta:
					<p:selectOneMenu id="pauta" style="width:200px;"
							value="#{gradeTributariaBean.gradeVig.pauta}">
							<f:selectItem itemLabel="Selecione uma Pauta" />
							<f:selectItems value="#{gradeTributariaBean.listaPauta}"
								var="pautaList" itemValue="#{pautaList}"
								itemLabel="#{pautaList.idPauta} - #{pautaList.descricao}" />
						</p:selectOneMenu>
					</h:panelGrid>
				</h:panelGrid>

				<p:tooltip id="toolTipAliq" for="aliq"
					value="Exibição 'Código' - 'Alíquota'" showEffect="clip"
					hideEffect="explode" />

				<p:tooltip id="toolTipPauta" for="pauta"
					value="Exibição 'Código' - 'Descrição da Pauta'" showEffect="clip"
					hideEffect="explode" />

				<p:commandButton value="Incluir"
					actionListener="#{gradeTributariaBean.incluirGradeVig}"
					update="listaGradeVig, gridincEdi2" />
			</p:dialog>
		</div>
	</h:form>
</body>
</html>